import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BillVO, BillForm, BillQuery } from '@/api/finance/bill/types';

/**
 * 查询收款登记列表
 * @param query
 * @returns {*}
 */

export const listBill = (query?: BillQuery): AxiosPromise<BillVO[]> => {
  return request({
    url: '/finance/bill/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收款登记详细
 * @param id
 */
export const getBill = (id: string | number): AxiosPromise<BillVO> => {
  return request({
    url: '/finance/bill/' + id,
    method: 'get'
  });
};

/**
 * 新增收款登记
 * @param data
 */
export const addBill = (data: BillForm) => {
  return request({
    url: '/finance/bill',
    method: 'post',
    data: data
  });
};

/**
 * 修改收款登记
 * @param data
 */
export const updateBill = (data: BillForm) => {
  return request({
    url: '/finance/bill',
    method: 'put',
    data: data
  });
};

/**
 * 删除收款登记
 * @param id
 */
export const delBill = (id: string | number | Array<string | number>) => {
  return request({
    url: '/finance/bill/' + id,
    method: 'delete'
  });
};
